------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  E:\REStat_MS14767_Vol96(2)\Data preparation Compustat segment\2_compustatamerica.log
  log type:  text
 opened on:  18 Dec 2014, 18:04:48

. *-----------------------------------------------------------------
. 
. ****************************************
. * This short file only drops non-american firms
. * from the compustat data set and creates a small
. * set with the country information.
. ****************************************
. 
. *****
. * 1 *
. *****
. 
. 
. 
. use "clean_compustat_master.dta", clear

. 
. keep ticker countryinc year

. so ticker year

. 
. save "ticker_country.dta", replace
(note: file ticker_country.dta not found)
file ticker_country.dta saved

. 
. *****
. * 2 *
. *****
. 
. use "clean_compustat_master.dta", clear

. 
. drop if countryinc!=0
(53928 observations deleted)

. 
. save "compustat_master_america.dta", replace
file compustat_master_america.dta saved

. 
. *log close
. 
end of do-file

. 
. **************************************
. * Third step: Segment Data set
. **************************************
. 
. * here the data set :raw data\segments_1986-1999.dta is included
. * We work only with business-segment data, thus we only keep observation which refere to buisiness segments.
. 
. * Even if there are not such double entries in the the segment database, it is usefull to drop the same firms.
. * If we would not do that, the double entries would emerge after merging the compustat data with the segment data.  
. 
. do 3_segmentdata.do

. cap clear mata

. cap clear

. capture log close
